<%@ page import="ghr.day0109.lottery.entity.UserMark" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %><%--
  Created by IntelliJ IDEA.
  User: Gong
  Date: 2023/1/10
  Time: 9:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>EL</title>
    <%
        //定义一个java变量
        String name = "1";
        //当前页面内置对象
        pageContext.setAttribute("elNamePageContext", name);
        //同一个请求内置对象
        request.setAttribute("elNameRequest", name);
        //同一个会话内置对象
        session.setAttribute("elNameSession", name);
        //同一个web应用内置对象
        application.setAttribute("elNameApplication", name);
        // 定义一个java对象
        UserMark userMark = new UserMark();
        userMark.setUserName("1");
        userMark.setPhone("12122120");
        pageContext.setAttribute("user", userMark);

        //定义一个java数组3
        int[] nums = {12, 34, 56, 78};
        request.setAttribute("arr",nums);
        //定义一个集合对象

        List<UserMark> userMarks = new ArrayList<>();
        userMarks.add(new UserMark(1001, "1"));
        userMarks.add(new UserMark(1002, "2"));
        request.setAttribute("list",userMarks);

    %>
</head>
<body>
<div>
    <ul>
        <li>使用jsp小脚本<%=name%>
        </li>
        <li>使用jsp内置对象<%out.print(name);%></li>
        <li>使用jsp中提供的getAttribute${pageContext.getAttribute("elNamePageContext")}</li>
        <li>使用jsp中EL表达式${elNameApplication}</li>
        <li>使用jsp 中对象${user.userName}</li>
        <li>使用jsp 中数组${arr[0]}</li>
        <li>使用jsp 中集合${list.get(0)}</li>
    </ul>
</div>
</body>
</html>
